package com.henanuniversity.service.impl;

import com.henanuniversity.dao.UserDao;
import com.henanuniversity.dao.impl.UserDaoImpl;
import com.henanuniversity.po.User;
import com.henanuniversity.service.UserService;
import com.henanuniversity.utils.DBUtils;

public class UserServiceImpl implements UserService {
    @Override
    public int saveUser(User user) {
        try {

        } catch (Exception e) {
            e.printStackTrace();
        }
        int result=1;
        UserDao userDao=new UserDaoImpl();
        userDao.saveUser(user);
        DBUtils.close();
        return result;
    }

    @Override
    public User getUserByIdByPass(String userId, String password) {
        User user=null;
        UserDao userDao=new UserDaoImpl();
        user = userDao.getUserByIdByPass(userId, password);
        DBUtils.close();
        return user;
    }

    @Override
    public User getUserById(String userId) {
        User user=null;
        UserDao userDao=new UserDaoImpl();
        user = userDao.getUserById(userId);
        DBUtils.close();
        return user;
    }
}
